﻿using Microsoft.AspNet.Identity;
using System.Threading.Tasks;

namespace Sidvall.IdentityManager.Security
{
	public class EmailService : IIdentityMessageService
	{
		public async Task SendAsync(IdentityMessage message)
		{
			var item = new Sidvall.Net.Mail.MailMessage()
			{
				Subject = message.Subject,
				RecipientAddresses = message.Destination,
				Body = message.Body,
				IsBodyHtml = true,
			};
			await Sidvall.SystemContext.Current.SmtpClientManager.SendAsync(item);
		}
	}
}
